package com.ruoyi.util;

import com.ruoyi.basedocument.domain.BomMaterialhalf;
import com.ruoyi.basedocument.domain.BomWfzbase;
import com.ruoyi.basedocument.mapper.BomMaterialhalfMapper;
import com.ruoyi.basedocument.mapper.BomWfzbaseMapper;
import com.ruoyi.basedocument.service.IBomMaterialhalfService;
import com.ruoyi.basedocument.service.IBomWfzbaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;

@Service
public class F7RenderingUtil {
    @Autowired
    private IBomWfzbaseService bomWfzbaseService;
    @Autowired
    private IBomMaterialhalfService bomMaterialhalfMapper;

    public HashMap<String, String> Rendering(String fid,String type){
        HashMap<String, String> hashMap = new HashMap<>();
        switch (type){
            case "wfzbase":
                BomWfzbase bomWfzbase = bomWfzbaseService.selectBomWfzbaseByFid(fid);
                hashMap.put("name",bomWfzbase.getFname());
                hashMap.put("number",bomWfzbase.getFname());
                break;
            case "materialhalf":
                BomMaterialhalf bomMaterialhalf = bomMaterialhalfMapper.selectBomMaterialhalfByFid(fid);
                hashMap.put("number",bomMaterialhalf.getFnumber());
                hashMap.put("name",bomMaterialhalf.getFname());
                break;
        }
        return hashMap;
    }
}
